"use strict";
cc._RF.push(module, 'c56feN05ThJQKJVb9TcoCoG', 'TweenUtil');
// eazax-ccc/utils/TweenUtil.ts

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
 * Tween 工具
 * @see TweenUtil.ts https://gitee.com/ifaswind/eazax-ccc/blob/master/utils/TweenUtil.ts
 * @version 20210320
 */
var TweenUtil = /** @class */ (function () {
    function TweenUtil() {
    }
    /**
     * 水平翻转（卡片翻转）
     * @param node 节点
     * @param duration 总时长
     * @param onMiddle 中间状态回调
     * @param onComplete 完成回调
     */
    TweenUtil.flip = function (node, duration, onMiddle, onComplete) {
        return new Promise(function (res) {
            var tween = cc.tween, time = duration / 2, scaleX = node.scale, skewY = scaleX > 0 ? 20 : -20;
            tween(node)
                .parallel(tween().to(time, { scaleX: 0 }, { easing: 'quadIn' }), tween().to(time, { skewY: -skewY }, { easing: 'quadOut' }))
                .call(function () {
                onMiddle && onMiddle();
            })
                .parallel(tween().to(time, { scaleX: -scaleX }, { easing: 'quadOut' }), tween().to(time, { skewY: 0 }, { easing: 'quadIn' }))
                .call(function () {
                onComplete && onComplete();
                res();
            })
                .start();
        });
    };
    return TweenUtil;
}());
exports.default = TweenUtil;

cc._RF.pop();